package com.jrh.web.showroom;

import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import com.jrh.biz.showroom.ShowroomService;
import com.jrh.domain.entity.Showroom;

/**
 * 样板间
 * 
 * @author zhu 2012-7-17 下午6:31:55
 */
@Controller
@RequestMapping("/showroom")
public class ShowroomController {

	@Autowired
	private ShowroomService showroomService;

	@RequestMapping("/index")
	public String index() {
		// showroomService.listShowroomByCondition(null);
		return "showroom/index";
	}

	@RequestMapping("/yangban")
	public String view(Model model) {
		Map<String, List<Showroom>> map = new LinkedHashMap<String, List<Showroom>>();
		map.put("美式乡村",
				showroomService.listShowroomsByStyle("1001").subList(0, 3));
		map.put("现代简约",
				showroomService.listShowroomsByStyle("1002").subList(0, 2));
		map.put("新古典",
				showroomService.listShowroomsByStyle("1003").subList(0, 3));
		map.put("欧美经典",
				showroomService.listShowroomsByStyle("1004").subList(0, 3));
		map.put("新中式",
				showroomService.listShowroomsByStyle("1005").subList(0, 3));
		map.put("东南亚",
				showroomService.listShowroomsByStyle("1006").subList(0, 3));
		map.put("地中海",
				showroomService.listShowroomsByStyle("1007").subList(0, 3));
		model.addAttribute("map", map);
		return "showroom/yangban";
	}

	@RequestMapping("/all/{style}")
	public String getAllStyle(@PathVariable String style, Model model) {

		return "showroom/pingpai";
	}

}
